﻿using MQTTnet.Client;

namespace IotClientApp.Server.MqttClient
{
    public interface IMqttClientService
    {
        Task<int> SubscribeAsync(string topicName);
        /// <summary>
        /// 取消订阅主题
        /// </summary>
        /// <param name="topicName"></param>
        /// <returns></returns>
        Task<int> UnSubscribeAsync(string topicName);
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="topicName"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        Task<MqttClientPublishResult> PublishAsync(string topicName, string message);
        Task ReceiveAsync(Action<MqttApplicationMessageReceivedEventArgs> action);
    }
}